package com.ss.android.lockscreen.d.a;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.ss.android.lockscreen.utils.a;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class b {
    String a;
    boolean b;
    private Class c;
    private StringBuilder d;
    private String e;

    public b(String arg2, Class arg3) {
        this(arg2, arg3, (byte) 0);
    }

    private b(String arg4, Class arg5, byte arg6) {
        this.a = arg4;
        this.c = arg5;
        this.d = new StringBuilder();
        this.b = true;
        this.a("json_content", "TEXT");
        if((com.ss.android.lockscreen.utils.a.a()) && !com.ss.android.lockscreen.d.a.aa.class.isAssignableFrom(this.c)) {
            throw new IllegalArgumentException("DataBaseManager: Data type " + this.c.getName() + " must be inherit from AbsDBData.class !");
        }
    }

    public final void a(String arg3, String arg4) {
        this.d.append(arg3).append(" ").append(arg4).append(",");
    }

    final com.ss.android.lockscreen.d.a.aa a(Cursor arg4) {
        com.ss.android.lockscreen.d.a.aa v0_1;
        int v1 = arg4.getColumnIndex("json_content");
        try {
            v0_1 = (aa) this.c.newInstance();
            v0_1.a(new JSONObject(arg4.getString(v1)));
        }
        catch(Exception v0) {
            v0.printStackTrace();
            v0_1 = null;
        }

        return v0_1;
    }

    public void a(ContentValues arg3, com.ss.android.lockscreen.d.a.aa arg4) {
        try {
            arg3.put("json_content", arg4.a().toString());
        }
        catch(JSONException v0) {
            v0.printStackTrace();
        }
    }

    final void a(SQLiteDatabase arg6) {
        if(this.e == null) {
            this.d.deleteCharAt(this.d.length() - 1);
            this.e = String.format(Locale.CHINA, "CREATE TABLE IF NOT EXISTS %s (%s)", this.a, this.d.toString());
        }

        arg6.execSQL(this.e);
    }

    public void a(com.ss.android.lockscreen.d.a.a.a arg1) {
    }

    public void a(com.ss.android.lockscreen.d.a.a.b arg1) {
    }
}

